package com.ruoyi.system.service.impl;

import java.math.BigDecimal;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SysHousingMapper;
import com.ruoyi.system.domain.SysHousing;
import com.ruoyi.system.service.ISysHousingService;

/**
 * 小区Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-08-07
 */
@Service
public class SysHousingServiceImpl implements ISysHousingService 
{
    @Autowired
    private SysHousingMapper sysHousingMapper;

    /**
     * 查询小区
     * 
     * @param housingId 小区主键
     * @return 小区
     */
    @Override
    public SysHousing selectSysHousingByHousingId(Long housingId)
    {
        return sysHousingMapper.selectSysHousingByHousingId(housingId);
    }

    /**
     * 查询小区列表
     * 
     * @param sysHousing 小区
     * @return 小区
     */
    @Override
    public List<SysHousing> selectSysHousingList(SysHousing sysHousing)
    {
        return sysHousingMapper.selectSysHousingList(sysHousing);
    }


    /**
     * 查询总储水量
     * @param deptId
     * @return
     */
    @Override
    public BigDecimal totalTankVolume (Long deptId){
        return sysHousingMapper.totalTankVolume(deptId);
    }
    /**
     * 新增小区
     * 
     * @param sysHousing 小区
     * @return 结果
     */
    @Override
    public int insertSysHousing(SysHousing sysHousing)
    {
        sysHousing.setCreateTime(DateUtils.getNowDate());
        return sysHousingMapper.insertSysHousing(sysHousing);
    }

    /**
     * 修改小区
     * 
     * @param sysHousing 小区
     * @return 结果
     */
    @Override
    public int updateSysHousing(SysHousing sysHousing)
    {
        sysHousing.setUpdateTime(DateUtils.getNowDate());
        return sysHousingMapper.updateSysHousing(sysHousing);
    }

    /**
     * 批量删除小区
     * 
     * @param housingIds 需要删除的小区主键
     * @return 结果
     */
    @Override
    public int deleteSysHousingByHousingIds(Long[] housingIds)
    {
        return sysHousingMapper.deleteSysHousingByHousingIds(housingIds);
    }

    /**
     * 删除小区信息
     * 
     * @param housingId 小区主键
     * @return 结果
     */
    @Override
    public int deleteSysHousingByHousingId(Long housingId)
    {
        return sysHousingMapper.deleteSysHousingByHousingId(housingId);
    }


    /**
     * 绑定热费
     * @param housingId
     * @param heatFeeId
     */
    @Override
    public void bindHeatFeedId( Long heatFeeId,Long housingId){
        sysHousingMapper.bindHeatFeedId(heatFeeId,housingId);
    }

    /**
     * 解绑热费
     * @param heatFeeId
     */
    @Override
    public void restHeatFeedId(Long heatFeeId){
        sysHousingMapper.restHeatFeedId(heatFeeId);
    }
}
